package com.sbio.udiapp.net.exception;

import com.sbio.udiapp.util.DialogUtil;

import java.util.function.Consumer;
import java.util.function.Supplier;

public class ErrorComsumerSupplier<T> {

    public static ErrorConsumer<?> of(Runnable err) {
        return new ErrorConsumer() {
            @Override
            public void error(ApiException ex) {
                err.run();
            }
        };
    }

    public static ErrorConsumer<?> of(Consumer<ApiException> consumer) {
        return new ErrorConsumer() {
            @Override
            public void error(ApiException ex) {
                consumer.accept(ex);
            }
        };
    }


}
